<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoldBeanPackagesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('gold_bean_packages', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->unsignedBigInteger('package_id')->comment('礼包ID');
            $table->decimal('total_beans', 18, 6)->default(0)->comment('礼包总KC通证');
            $table->decimal('remaining_beans', 18, 6)->default(0)->comment('剩余待释放KC通证');
            $table->decimal('daily_release_rate', 5, 2)->default(0)->comment('释放百分比');
            $table->decimal('purchase_amount', 18, 2)->default(0)->comment('购买金额');
            $table->integer('release_days')->default(1)->comment('总释放天数');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `gold_bean_packages` comment 'KC通证礼包购买记录'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('gold_bean_packages');
    }
}
